package com.luoye.lj.wstool.web;

import com.luoye.lj.wstool.generator.ICodeGenerator;
import com.luoye.lj.wstool.web.entity.WebtEntity;
import com.luoye.lj.wstool.web.entity.WebtField;

/*
 * Created with IntelliJ IDEA.
 * User: Dave Liu
 * Date: 2016/4/26
 * Time: 15:47
 * To change this template use File | Settings | File Templates.
 */
public class ToStringCodeGenerator implements ICodeGenerator {
    private WebtEntity webtEntity;

    public ToStringCodeGenerator(WebtEntity webtEntity) {
        this.webtEntity = webtEntity;
    }
    @Override
    public String codeGenerate() {
        String code="";
        if(this.webtEntity!=null){
            if(this.webtEntity.getFieldList()!=null){
                for(WebtField webtField:this.webtEntity.getFieldList()){
                    code+="                \"\'"+webtField.getFieldName()+"\'=\'\" + "+webtField.getFieldName()+" + \"\',\" +\n";
                }
            }
        }
        return code;
    }
}
